package com.milageincrease.config;

import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.ConnectionFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.io.IOException;

@Configuration
public class HBaseConfig {

    @Bean
    public Connection hbaseConnection() throws IOException {
        System.out.println("creating HBase bean");
        //1、创建hbase配置
        org.apache.hadoop.conf.Configuration conf = HBaseConfiguration.create();
        //2、创建hbase的连接
        Connection connection = ConnectionFactory.createConnection(conf);
        return connection;
    }
}